package com.topisv.tms.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.topisv.tms.entity.Permission;

public interface PermissionDao extends PagingAndSortingRepository<Permission, Long>,JpaSpecificationExecutor<Permission> {
	@Query("select p from Roleperm rp , Permission p where rp.permission = p.id and rp.role.id=?")
	List<Permission> findByRoleId(Long roleid);
	
	@Query("select p from Permission p where p.function.id = ?")
	List<Permission> findByFunctionId(Long functionid);
}
